package com.sys.sprinngboot.goodtheater.controller;

import com.sys.sprinngboot.goodtheater.bean.Drama;
import com.sys.sprinngboot.goodtheater.service.DramaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class DramaController {
    @Autowired
    DramaService dramaService;


    @GetMapping("/")
    public String getDrama(Model model){
        List<Drama> dramas = dramaService.dramaAll();
        model.addAttribute("dramas" , dramas);
        return "movie-list";
    }
}
